#define _GNU_SOURCE
#include <app_pool.h>
#include <stdlib.h>
#include "log/log.h"
#include <unistd.h>

int task_func(void * arg)
{
    char *name = (char *)arg;
    log_debug("task func execute,name:%s,tid=%d",name,gettid());
    free(name);
    return 0;
}
int main(int argc, char const *argv[])
{
    app_pool_init(5);
    for (int i = 0; i < 10; i++)
    {
        char * name = (char *)malloc(10);
        sprintf(name, "%s_%d", "vsgo", i);
        // log_debug("add task arg=%s,tid=%d",name,gettid());
        app_pool_register_task(task_func,name);
    }
    sleep(5); //确保任务已经全部执行完毕 等待5秒
    app_pool_close();
    return 0;
}
